﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DVSProject.Models.ReportModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    IndexLoadDefault
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        รายงานสรุปรายเดือน</h2>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".date").datepicker({ dateFormat: 'dd-mm-yy' });
            //getter
            var dateFormat = $(".date").datepicker("option", "dateFormat");
            //setter
            $(".date").datepicker("option", "dateFormat", 'dd-mm-yy');
            $('.date').datepicker();

        });

        //          if ($("#start_date").val() != '') {
        //              var arrDate = $('#start_date').val().split(" ");
        //              $('#start_date').val(arrDate[0]);
        //          }

        //          if ($("#end_date").val() != '') {
        //              var arrDate = $('#end_date').val().split(" ");
        //              $('#end_date').val(arrDate[0]);
        //          }


        function SimpleInNewWin() {
            window.open("../FromMvc/ShowSimple");
        }


        function GenericInNewWin() {
            var oParam = { "FromDate": "", "ToDate": "" };
            oParam.FromDate = $("#model.start_date").val();
            oParam.ToDate = $("#model.end_date").val();

            $.ajax({
                url: '../../FromMvc/IndexLoadDefault',
                type: 'POST',
                contentType: 'application/json',
                data: JSON.stringify(oParam),
                dataType: 'json',
                success: function () {
                    window.open("../GenericReportViewer/ShowGenericRpt", 'mywindow', 'fullscreen=yes, scrollbars=auto');
                },
                error: function (jqXHR, exception) {
                    alert('Error message.');
                }

            });



        }
    </script>
    <% using (Html.BeginForm())
       {%>
    <%= Html.ValidationSummary(true) %>
    <fieldset>
        <legend>เงื่อนไขรายงาน</legend>
        <div class="editor-label">
            เครื่อง :
        </div>
        <div class="editor-field">
            <%=Html.DropDownListFor(model => model.product, Model.ProductSelect)%>
        </div>
        <div class="editor-label">
            เดือน :
        </div>
        <div class="editor-field">
            <%=Html.DropDownListFor(model => model.set_month, Model.MonthShowSelect)%>
        </div>
        <div class="editor-label">
            วันที่จดมิเตอร์ :
        </div>
        <div class="editor-field">
            <%= Html.TextBoxFor(model => model.start_date, new { @class = "date" })%>
            <%= Html.ValidationMessageFor(model => model.start_date)%>
        </div>
        <div class="editor-label">
            ถึง:
        </div>
        <div class="editor-field">
            <%= Html.TextBoxFor(model => model.end_date, new { @class = "date" })%>
            <%= Html.ValidationMessageFor(model => model.end_date)%>
        </div>
        <p>
            <input class="buttonSummit" type="submit" value="View" />
        </p>
    </fieldset>
    <%} %>
</asp:Content>
